package com.zhongke.cotrun.controller;

import com.zhongke.cotrun.common.util.APIResponse;
import com.zhongke.cotrun.model.pojo.LeaveWord;
import com.zhongke.cotrun.model.resultpackage.CodeMsg;
import com.zhongke.cotrun.service.LeaveWordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/LeaveWord")
public class LeaveWordController {
    @Autowired
    LeaveWordService leaveWordService;
    /**
     * 添加留言
     * @param leaveWord
     * @return
     */
    @PostMapping ("/addLeaveWord")
    public APIResponse addLeaveWord(LeaveWord leaveWord){
       if(leaveWordService.addLeaveWord(leaveWord)) {
           return APIResponse.returnSuccess();
       }
       return APIResponse.returnFail(CodeMsg.ADD_ERROR);

    }
}
